package io.zsy.annotation.service;

import io.zsy.annotation.dao.UserDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * @author zhangshuaiyin
 * @date 2022/4/24 20:47
 */
@Service(value = "userService")
public class UserService {

    @Value(value = "zhangsan")
    private String name;

    @Autowired
    @Qualifier(value = "userDaoImpl")
    public UserDao userDao;

    @Resource
    public UserDao userMapper;

    @Resource(name = "userMapper")
    public UserDao userDao2;

    public void add() {
        System.out.println("UserService - 注解value属性可以省略，缺省值为类名首字母小写 我叫" + name);
        userDao.add();
        userDao2.add();
        userMapper.add();
    }
}
